<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:t="http://myfaces.apache.org/tomahawk">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="Crear una Nueva Campana"></h:outputText>
        </ui:define>
        <ui:define name="body" >
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form enctype="multipart/form-data">
                <h:panelGrid columns="2">
                    
                    <h:outputLabel value="Descripcion" for="campaigndescription" />
                    <h:inputText id="campaigndescription" value="#{campaignsController.selected.campaigndescription}" title="Descripcion" />
                    
                    <h:outputLabel value="Producto Asociado" for="productid" />
                    <h:inputText id="productid" value="#{campaignsController.selected.productid}" title="Producto " />
                    
                    <h:outputLabel value="Fecha de Validez (yyyy/MM/dd)" for="campaigndate" />
                    <h:inputText id="campaigndate" value="#{campaignsController.selected.campaigndate}" title="Fecha de Validez" >
                        <f:convertDateTime pattern="yyyy/MM/dd" />
                    </h:inputText>
                    
                    <h:outputLabel value="Ubicacion de la Imagen" for="campaignimage" />
                    <t:inputFileUpload id="file" value="#{campaignsController.uploadedFile}" required="true" title="Ubicacion de la Imagen"/>
                    
                    <h:outputLabel value="URL de la Imagen" for="campaignimageurl" />
                    <h:inputText id="campaignimageurl" value="#{campaignsController.selected.campaignimageurl}" title="URL de la Imagen" />
                    
                </h:panelGrid>
                <br />
                <h:commandLink action="#{campaignsController.create}" value="Crear" />
                <br />
                <br />
                <h:commandLink action="#{campaignsController.prepareList}" value="Ver Campanas" immediate="true"/>
                <br />
                <br />
                <h:commandLink value="Menu Principal" action="/index" immediate="true" />
            </h:form>
        </ui:define>
    </ui:composition>

</html>
